/* cli config */
const webpack = require('webpack')
// const sourceMap = process.env.ENV === 'testing' // if testing mode, need map
// const resolve = dir => require('path').join(__dirname, dir)
module.exports = {
  lintOnSave: false,
  publicPath: './',
  configureWebpack: {},
  productionSourceMap: false,
  css: {
    loaderOptions: {
      less: {
        modifyVars: {
          /* less 变量覆盖，用于自定义 ant design 主题 */
          'primary-color': '#008FFF',
          'link-color': '#008FFF',
          'border-radius-base': '4px'
        },
        javascriptEnabled: true
      }
    }
  },
  chainWebpack: config => {
    config.plugin('provide').use(webpack.ProvidePlugin, [
      {
        videojs: 'video.js'
      }
    ])
  },
  devServer: {
    port: 3033,
    hot: true,
    hotOnly: true,
    proxy: {
      // '/user/ucenter': {
      //   target: 'http://dev-p0104-b001-standard-product-ucenter:30080',
      //   changeOrigin: true
      //   // pathRewrite: {
      //   //   '^/user': '/'
      //   // }
      // },
      // dev-p0106-b007-chinaunicom-standard-platform-gateway

      // demo-p0106-b007-chinaunicom-standard-platform-gateway
      '/api': {
        target: 'http://192.168.100.127:8088/',
        changeOrigin: true
      },
      // '/api1': {
      //   target: 'http://192.168.1.29:9012',
      //   changeOrigin: true,
      //   pathRewrite: {
      //     '^/api1': '/'
      //   }
      // },
      // '/ucenter': {
      //   target: 'http://dev-p0104-b001-standard-product-ucenter:30080',
      //   changeOrigin: true
      // },
      '/patrol': {
        target: 'http://192.168.100.127:8088',
        changeOrigin: true,
        pathRewrite: {
          '^/patrol': '/'
        }
      },
      '/eqpt': {
        target: 'http://192.168.100.127:8088', // 'http://10.9.101.22:9812',
        changeOrigin: true,
        pathRewrite: {
          '^/eqpt': '/'
        }
      },
      '/alarm': {
        target: 'http://192.168.100.127:8088',
        changeOrigin: true,
        pathRewrite: {
          '^/alarm': '/'
        }
      },
      '/workorder': {
        target: 'http://192.168.100.127:8088',
        changeOrigin: true,
        pathRewrite: {
          '^/workorder': '/'
        }
      },
      '/repair': {
        target: 'http://192.168.100.127:8088',
        changeOrigin: true,
        pathRewrite: {
          '^/repair': '/'
        }
      },
      '/video': {
        target: 'http://192.168.100.127:8088',
        changeOrigin: true,
        pathRewrite: {
          '^/video': '/'
        }
      },
      '/notice': {
        target: 'http://192.168.100.127:8088',
        changeOrigin: true,
        pathRewrite: {
          '^/notice': '/'
        }
      },
      '/prevention': {
        target: 'http://192.168.100.127:8088',
        changeOrigin: true,
        pathRewrite: {
          '^/prevention': '/'
        }
      },
      '/classroom': {
        target: 'http://180.166.206.172:9536',
        changeOrigin: true,
        pathRewrite: {
          '^/classroom': '/classroom'
        }
      }
      // '/manage': {
      //   target: 'http://10.9.101.23:19099',
      //   changeOrigin: true
      // },
      // '/meeting': {
      //   target: 'http://10.9.101.22:39112',
      //   changeOrigin: true,
      //   pathRewrite: {
      //     '^/meeting': '/'
      //   }
      // },
      // '/visitor': {
      //   target: 'http://10.9.101.22:19799',
      //   changeOrigin: true,
      //   pathRewrite: {
      //     '^/visitor': '/'
      //   }
      // }
    }
  }
}
